package com.wiscamp.ninechapters.problems.infrastructure.mappers.problems;

import com.wiscamp.ninechapters.problems.infrastructure.po.problems.QuestionView;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.jpa.repository.Query;
import org.springframework.stereotype.Repository;

import java.util.Collection;

/**
 * 问题仓储对象
 *
 * @author yifeng
 */
@Repository
public interface QuestionViewMapper extends JpaRepository<QuestionView, Long>, JpaSpecificationExecutor<QuestionView> {
    /**
     * 通过题编号获取问题列表
     *
     * @param itemId
     * @return
     */
    @Query(value = "select e from QuestionView e where e.problemId = :problemId")
    Collection<QuestionView> findListByProblem(long problemId);
}